package com.example.sys.entity.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.sys.entity.enums.GradeEnum;
import com.example.sys.entity.types.ArticleTypeHandle;
import com.example.sys.entity.types.DelimitedStringNotNullTypeHandler;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author ZhengDing
 * @since 2022-01-28 09:31:35
 */
@Data
@Accessors(chain = true)
@TableName(value = "xf_article", autoResultMap = true)
@ApiModel(value = "Article对象", description = "")
@NoArgsConstructor
@AllArgsConstructor
public class ArticleDto implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @TableField("title")
    private String title;

    @TableField("content")
    private String content;
    
    private String username;
    private String password;

    //@TableField(value = "create_by", jdbcType = JdbcType.INTEGER, javaType = true, typeHandler = UserInfoTypeHandler.class)
    //private User createBy;
    
    //@TableField(value = "create_by", typeHandler = UserInfoTypeHandler.class)
    //private User createBy;

    @TableField(value = "category", typeHandler = ArticleTypeHandle.class)
    private String category;

    @TableField(value = "langs", typeHandler = DelimitedStringNotNullTypeHandler.class)
    private List<String> langs;

    @TableField(value = "grade")
    private GradeEnum grade;

    //@TableField(value = "style", typeHandler = EnumOrdinalTypeHandler.class)
    //private StyleEnum style;


    public static final String ID = "id";

    public static final String TITLE = "title";

    public static final String CONTENT = "content";

    public static final String CREATE_BY = "create_by";

    public static final String CATEGORY = "category";

}
